# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -run-pass=amdgpu-prelegalizer-combiner -verify-machineinstrs -o - %s | FileCheck %s

---
name: s32_bitcast
tracksRegLiveness: true
body: |
  bb.0:
    liveins: $vgpr0
    ; CHECK-LABEL: name: s32_bitcast
    ; CHECK: liveins: $vgpr0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: %src:_(<2 x s16>) = COPY $vgpr0
    ; CHECK-NEXT: $vgpr0 = COPY %src(<2 x s16>)
    %src:_(<2 x s16>) = COPY $vgpr0
    %b1:_(s32) = G_BITCAST %src
    %b2:_(<2 x s16>) = G_BITCAST %b1
    $vgpr0 = COPY %b2
...

---
name: s64_bitcast
tracksRegLiveness: true
body: |
  bb.0:
    liveins: $vgpr0_vgpr1
    ; CHECK-LABEL: name: s64_bitcast
    ; CHECK: liveins: $vgpr0_vgpr1
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: %src:_(<2 x s32>) = COPY $vgpr0_vgpr1
    ; CHECK-NEXT: $vgpr0_vgpr1 = COPY %src(<2 x s32>)
    %src:_(<2 x s32>) = COPY $vgpr0_vgpr1
    %b1:_(s64) = G_BITCAST %src
    %b2:_(<2 x s32>) = G_BITCAST %b1
    $vgpr0_vgpr1 = COPY %b2
...

---
name: s64_bitcast_differentypes_nofold
tracksRegLiveness: true
body: |
  bb.0:
    liveins: $vgpr0_vgpr1
    ; CHECK-LABEL: name: s64_bitcast_differentypes_nofold
    ; CHECK: liveins: $vgpr0_vgpr1
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: %src:_(<2 x s32>) = COPY $vgpr0_vgpr1
    ; CHECK-NEXT: %b1:_(s64) = G_BITCAST %src(<2 x s32>)
    ; CHECK-NEXT: %b2:_(<4 x s16>) = G_BITCAST %b1(s64)
    ; CHECK-NEXT: $vgpr0_vgpr1 = COPY %b2(<4 x s16>)
    %src:_(<2 x s32>) = COPY $vgpr0_vgpr1
    %b1:_(s64) = G_BITCAST %src
    %b2:_(<4 x s16>) = G_BITCAST %b1
    $vgpr0_vgpr1 = COPY %b2
...
